home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 5122 < prev    next >
Encoding:
Text File  |  1996-08-06  |  1.3 KB  |  44 lines

  1. Path: cdshub.cdc.com!usenet
  2. From: Jesper Bagger <Jesper.Bagger@cdc.com>
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: using c & c++ with Solaris
  5. Date: 2 Feb 1996 15:29:41 GMT
  6. Organization: Control Data Denmark
  7. Message-ID: <4etal5$fp4@cdshub.cdc.com>
  8. References: <4em295$q5d@data.wcupa.edu>
  9. NNTP-Posting-Host: 129.179.133.82
  10. Mime-Version: 1.0
  11. Content-Type: text/plain; charset=us-ascii
  12. Content-Transfer-Encoding: 7bit
  13. X-Mailer: Mozilla 1.22 (Windows; I; 16bit)
  14.  
  15. William writes:
  16.  
  17. >I'm fairly new at using unix for c programming, and though this question
  18. >may reflect my newbie-ness, would anyone be so kind as to pardon my green
  19. >aura(?): if C++ is a superset of "C", why does "cc" (object oriented
  20. >compiler) choke when I sent it "C" language commands (like "printf")?
  21. >Should not all the libraries (etc.) be there?  Or is this a system specific
  22. >problem (ie. - "specifically MY system?")
  23.  
  24. I dont no if it solves your problem, but if you want to use c-library functions in C++, 
  25. you should include the header files with:
  26.  
  27. extern "C" {
  28.    #include <stdlib.h>
  29. }
  30.  
  31. As far as I know, all header files on Solaris test whether or not CPLUSPLUS is defined, 
  32. and add the "extern" declaration if needed. In that case you can write:
  33.  
  34. #include <stdlib.h>
  35.  
  36. in order to get a prototype of printf.
  37.  
  38. With regards
  39.  
  40. Jesper Bagger
  41. Control Data Denmark A/S
  42.  
  43.  
  44.